x, y = map(int, input().split())

cnt = 0

for i in range(min(x, y), max(x, y) + 1):
    if i % x or y % i:
        continue
    for j in range(min(x, y), max(x, y) + 1):
        if j % x or y % j:
            continue
        if i * j == x * y:
            cnt += 1

print(cnt)
